import request from '@/utils/request';

//批量删除课件
export const removeCourseware = (list) => {
    return request({
        url: '/eduM2/eduCourseware/removeCourseware',
        method: 'post',
        data: list
    })
}

//添加独立课件
export const addCourseware = (row) => {
    return request({
        url: '/eduM2/eduCourseware/addCourseware',
        method: 'post',
        data: row
    })
}

//添加小节课件
export const addCoursewareOfChapter = (row) => {
    return request({
        url: '/eduM2/eduCourseware/addCoursewareOfChapter',
        method: 'post',
        data: row
    })
}

//课件上架/下架
export const updateCoursewareStatus = (id, status) => {
    return request({
        url: '/eduM2/eduCourseware/updateCoursewareStatus/' + id + '/' + status,
        method: 'get',
    })
}

//修改课件信息
export const updateCourseware = (row) => {
    return request({
        url: '/eduM2/eduCourseware/updateCourseware',
        method: 'post',
        data: row
    })
}

//分页查询课程信息
export const queryCoursewareList = (params, current, limit, companyId) => {
    return request({
        url: '/eduM2/eduCourseware/pageCoursewareCondition/' + companyId + '/' + current + '/' + limit,
        method: 'post',
        data: params
    })
}

//查询课件学习记录
export const getCoursewareRecordList = (params) => {
    return request({
        url: '/eduM2/eduCoursewareRecord/getRecordsByCondition',
        method: 'post',
        data: params
    })
}

// 根据章节id查询课件
export const getCoursewareByChapterId = (chapterId) => {
    return request({
        url: '/eduM2/eduCourseware/getCoursewareByChapterId/' + chapterId,
        method: 'get',
    })
}

//根据章节id删除对应的课程课件
export const removeCoursewareByChapterId = (chapterId) => {
    return request({
        url: '/eduM2/eduCourseware/removeCoursewareBychapterId/' + chapterId,
        method: 'get',
    })
}

